import numpy as np

def main (gender, age, weight, height):
    weight_arr = np.array(weight)
    height_arr = np.array(height)
    age_arr = np.array(age)

    if gender == "男":
        bmr = (13.7 * weight_arr) + (5.0 * height_arr) - (6.8 * age_arr) + 66
    else:
        bmr = (9.6 * weight_arr) + (1.8 * height_arr) - (4.7 * age_arr) + 655

    return bmr


while True:
    try:
        gender, age, weight, height = input("请输入性别（男/女）、年龄（岁）、体重（kg）、身高（cm），用空格隔开：").split()
        age = int(age)
        weight = float(weight)
        height = float(height)
    except ValueError:
        print("您的输入有误，请按照规定格式输入。")
        choice = input("是否退出？（Y/N）")
        if choice.lower() == "y":
            break
        continue

    bmr = main (gender, age, weight, height)
    print("您的BMR值为：", bmr)

    choice = input("是否继续计算BMR值？（Y/N）")
    if choice.lower() == "n":
        break
